// citylist
package parser

import (
	"regexp"
	"crowler/engine"
)

const cityListRe = `<a href="(http://www.zhenai.com/zhenghun/[a-zA-Z0-9]+)"[^>]+>([^<]+)</a>`

func ParseCityList(contents []byte) engine.ParseResult {

	re := regexp.MustCompile(cityListRe)


	match := re.FindAllSubmatch(contents, -1)

	result := engine.ParseResult{}

	limit := 10
	for _, m := range match {
		


		result.Items = append(result.Items,string(m[2]))
		result.Requests = append(
			result.Requests,engine.Request{
				Url:string(m[1]),
				ParsetFunc:ParseCity,})

		limit --
		if limit  == 0 {
			break
		}
	}

	return result
	
}


